package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import model.VoceSabia;

public class VoceSabiaDao {

	public VoceSabia getVoceSabia(){
		
		Connection con = ConnectionPostgreSqlPool.getConnectionManual();
		PreparedStatement stm = con.prepareStatement("SELECT mensagem FROM voceSabia ORDER BY rand() LIMIT 1");
		
		ResultSet result = stm.executeQuery();
		VoceSabia vs;
		
		
		while(result.next()){
			vs = new VoceSabia(result.getString(1));
       }
  
       stm.close();
       con.close();
       
       return vs;
	}
	
}
